<template>
  <div id="app">
    <el-container>
      <el-header :style="[showSidebar ? center : {}]">
        <div class="logo">
          <img src="./static/horLogo.webp" alt />
        </div>
        <el-menu
          v-if="!showSidebar"
          class="el-menu-demo"
          mode="horizontal"
          :ellipsis="false"
        >
          <el-menu-item @click="$router.push('/Home')" class="item"
            >首页</el-menu-item
          >
          <el-menu-item @click="$router.push('/News')" class="item"
            >新闻资讯</el-menu-item
          >
          <el-menu-item @click="$router.push('/Case')" class="item"
            >开设楼盘</el-menu-item
          >
          <el-menu-item @click="$router.push('/GoIn')" class="item"
            >走进民邦</el-menu-item
          >
        </el-menu>
      </el-header>
      <el-main>
        <NuxtPage />
      </el-main>
      <div class="footer">
        <div class="footer-content">
          <div class="logo">
            <img src="./static/horLogo.webp" alt="" />
          </div>
          <ul class="content-nav">
            <li>
              <p>新闻资讯</p>
              <span>公司新闻</span>
              <span>行业动态</span>
            </li>
            <li>
              <p>走进民邦</p>
              <span>发展历程</span>
              <span>企业文化</span>
              <span>资质荣誉</span>
              <span>合作伙伴</span>
            </li>
            <li>
              <p>联系我们</p>
              <span>邮箱：2911107728@qq.com</span>
              <span>电话：19122530926</span>
              <span>
                地址：湖北省孝感市高新技术开发区槐荫办事处东李咀社区民邦璞樾17幢601室
              </span>
            </li>
          </ul>
        </div>
        <div class="copyright">
          <span>
            ©2025
            <span>Min Bang</span>
            All Rights Reserved
          </span>
        </div>
      </div>
      <sidebar v-if="showSidebar" style="position: fixed; left: 0; top: 0" />
    </el-container>
  </div>
</template>

<script setup>
import { ref, computed, onMounted, onBeforeUnmount } from "vue";
import Sidebar from "~/components/Sidebar.vue";
useSeoMeta({
  title: "民邦集团官网",
});
const center = {
  justifyContent: "center",
};
const windowWidth = ref(0);

const showSidebar = computed(() => windowWidth.value < 800);

const handleResize = () => {
  windowWidth.value = document.documentElement.clientWidth;
};

onMounted(() => {
  windowWidth.value = document.documentElement.clientWidth;
  window.addEventListener("resize", handleResize);
});

onBeforeUnmount(() => {
  window.removeEventListener("resize", handleResize);
});
</script>

<style lang="scss">
.page-enter-active,
.page-leave-active {
  transition: all 0.3s;
}
.page-enter-from {
  opacity: 0;
  transform: translateX(100%);
}
.page-leave-to {
  opacity: 0;
  transform: translateX(-100%);
}
* {
  padding: 0;
  margin: 0;
}
html,
body {
  height: 100%;
}

#app {
  font-family: "Avenir", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
}

.el-header {
  display: flex;
  justify-content: space-between;
  align-content: center;
  width: 100%;
  .el-menu-demo {
    .item {
      margin: 0 20px;
    }
  }
  .logo {
    margin-top: 5px;
    width: 180px;
    aspect-ratio: 3;
    img {
      width: 180px;
    }
  }
}
.el-main {
  padding: 0 !important;
}
.footer {
  width: 100%;
  overflow: hidden;
  background-color: #001529;
  &-content {
    width: 100%;
    margin: 0 auto;
    padding: 40px 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    .content-nav {
      display: flex;
      justify-content: space-around;
      li {
        display: flex;
        flex-direction: column;
        padding: 0 20px;
        align-items: flex-start;
        p {
          font-size: 20px;
          color: rgb(204, 204, 204);
          padding: 10px 0;
        }
        span {
          color: rgb(153, 153, 153);
          font-weight: 300;
          padding: 5px 0;
        }
      }
    }

    img {
      width: 18vw;
      height: 5vw;
      padding: 10px;
    }
  }
  .copyright {
    display: flex;
    justify-content: center;
    align-content: center;
    height: 30px;
    background: #001529;
    span {
      color: rgb(153, 153, 153);
      line-height: 30px;
      span {
        color: #2f54eb;
      }
    }
  }
  @media screen and (max-width: 1180px) {
    .footer {
      &-content {
        padding: 20px 0;
        .content-nav {
          display: none;
        }
        .logo {
          margin: 0;
          img {
            width: 250px;
            height: 70px;
          }
        }
      }
    }
  }
}
</style>
